<template>
  <div>
    <h1>展示页</h1>
    <el-button @click="goHome">回首页</el-button>
    <p>
      localStorage中的对象={{data}}
    </p>
    <p>
      添加值: <el-button @click="add">添加</el-button>
    </p>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'
import storage from '../utils/storage'
const router = useRouter()
const goHome = () => {
  router.push('/welcome')
}
let data = storage.getStorage()
const add = () => {
  storage.setItem('name', 'li')
  storage.setItem('cname', 'lisi')
  storage.setItem('aname', 'li')
  storage.setItem('aname', 'zhangsna')
  data = storage.getStorage()
}
</script>

<style>
</style>
